package com.leyou.page.feign;

import com.leyou.common.constants.LyConstants;
import com.leyou.page.scheduler.AppTokenScheduler;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @date: 2021/4/12 0012 17:22
 * @description:
 */
@Component
public class FeignInterceptor implements RequestInterceptor {
    @Autowired
    private AppTokenScheduler appTokenScheduler;

    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header(LyConstants.APP_TOKEN_HEADER,appTokenScheduler.getAppToken());
    }
}
